package sim

import (
	"github.com/gogf/gf/v2/frame/g"
	"github.com/sagoo-cloud/sagooiot/api/v1/common"
)

// GetSimHistoryTrafficListReq 获取数据列表
type GetSimHistoryTrafficListReq struct {
	g.Meta    `path:"/sim_history_traffic/list" method:"get" summary:"获取某月/某天历史流量列表" tags:"物联网卡管理"`
	KeyWord   string   `json:"keyWord" dc:"access_number接入号码"` //搜索关键字
	DateRange []string `p:"dateRange"`                         //日期范围
	OrderBy   string   //排序方式
	PageNum   int      `json:"pageNum" in:"query" d:"1"  v:"min:0#分页号码错误"     dc:"分页号码，默认1"`
	PageSize  int      `json:"pageSize" in:"query" d:"10" v:"max:50#分页数量最大50条" dc:"分页数量，最大50"`
	Types     int      `json:"types"`
	Month     string   `json:"month" dc:"查询某月的历史数据，格式202401，month、day参数只能传一个" `
	Day       string   `json:"day" dc:"查询某天的历史数据，格式20240101" `
}
type GetSimHistoryTrafficListRes struct {
	Data []GetSimHistoryTrafficByIdRes
	common.PaginationRes
}

// GetSimHistoryTrafficByIdReq 获取指定ID的数据
type GetSimHistoryTrafficByIdReq struct {
	g.Meta `path:"/sim_history_traffic/get" method:"get" summary:"获取某月/某天历史流量" tags:"物联网卡管理"`
	Id     int `json:"id"        description:"id" v:"required#id不能为空"`
}
type GetSimHistoryTrafficByIdRes struct {
	Id           string `json:"id"          description:""`
	CreatedAt    string `json:"createdAt"          description:""`
	UpdatedAt    string `json:"updatedAt"          description:""`
	FlowAmount   string `json:"flowAmount"          description:"流量"`
	FlowDay      string `json:"flowDay"          description:"日期"`
	Unit         string `json:"unit"          description:"单位"`
	Types        string `json:"types"          description:"1电信,2联通,3移动"`
	Iccid        string `json:"iccid"          description:"iccid"`
	Imsi         string `json:"imsi"          description:"imsi"`
	AccessNumber string `json:"accessNumber"          description:""`
}

// AddSimHistoryTrafficReq 添加数据
type AddSimHistoryTrafficReq struct {
	g.Meta       `path:"/sim_history_traffic/add" method:"post" summary:"添加某月/某天历史流量" tags:"物联网卡管理"`
	CreatedAt    string `json:"createdAt"          description:""`
	UpdatedAt    string `json:"updatedAt"          description:""`
	FlowDay      string `json:"flowDay"          description:"日期"`
	Unit         string `json:"unit"          description:"单位"`
	Types        string `json:"types"          description:"1电信,2联通,3移动"`
	Iccid        string `json:"iccid"          description:"iccid"`
	Imsi         string `json:"imsi"          description:"imsi"`
	AccessNumber string `json:"accessNumber"          description:""`
	FlowAmount   string `json:"flowAmount"          description:"流量"`
}
type AddSimHistoryTrafficRes struct{}

// EditSimHistoryTrafficReq 编辑数据api
type EditSimHistoryTrafficReq struct {
	g.Meta       `path:"/sim_history_traffic/edit" method:"put" summary:"编辑某月/某天历史流量" tags:"物联网卡管理"`
	Iccid        string `json:"iccid"          description:"iccid"`
	Imsi         string `json:"imsi"          description:"imsi"`
	AccessNumber string `json:"accessNumber"          description:""`
	FlowAmount   string `json:"flowAmount"          description:"流量"`
	FlowDay      string `json:"flowDay"          description:"日期"`
	Unit         string `json:"unit"          description:"单位"`
	Types        string `json:"types"          description:"1电信,2联通,3移动"`
	Id           string `json:"id"          description:""`
	CreatedAt    string `json:"createdAt"          description:""`
	UpdatedAt    string `json:"updatedAt"          description:""`
}
type EditSimHistoryTrafficRes struct{}

// DeleteSimHistoryTrafficReq 删除数据
type DeleteSimHistoryTrafficReq struct {
	g.Meta `path:"/sim_history_traffic/delete" method:"delete" summary:"删除某月/某天历史流量" tags:"物联网卡管理"`
	Ids    []int `json:"ids"        description:"ids" v:"required#ids不能为空"`
}
type DeleteSimHistoryTrafficRes struct{}

type SimHTrafficStatisReq struct {
	g.Meta `path:"/sim_traffic_statis/get" method:"get" summary:"仪表盘统计接口" tags:"物联网卡管理"`
	Types  string `json:"types" v:"required#请填写运营商类型" dc:"1电信,2联通,3移动"`
}
type SimHTrafficStatisRes struct {
	RealMonthTotal float64 `json:"realMonthTotal" dc:"当月流量消耗"`
	RealDayTotal   float64 `json:"realDayTotal" dc:"当日流量消耗"`
	YesterdayTotal float64 `json:"yesterdayTotal" dc:"昨日流量消耗"`
	YearTotal      float64 `json:"yearTotal" dc:"本年流量消耗"`
}

type SimHistoryChartsReq struct {
	g.Meta `path:"/sim_history_traffic/date" method:"post" summary:"仪表盘折线接口" tags:"物联网卡管理"`
	Types  int    `json:"types" v:"required#请填写运营商类型" dc:"1电信,2联通,3移动"`
	Sdate  string `json:"sdate" v:"required#请填写开始时间" dc:"开始时间 2024-01-05 15:04:05"`
	Edate  string `json:"edate" v:"required#请填写开始时间" dc:"开始时间 2024-01-05 15:04:05"`
}
type SimHistoryChartsRes struct {
	Data []TopFlowData `json:"data" dc:"流量消耗流水"`
}

type TopFlowData struct {
	AcceccNumber string  `json:"accessNumber" dc:"卡号"`
	Value        float64 `json:"value" dc:"流量"`
	Date         string  `json:"date"`
}

type MonthData struct {
	Month string `json:"month" dc:"月份"`
	Value string `json:"value" dc:"月流量统计"`
}

// 流量排行榜
type TopFLowReq struct {
	g.Meta `path:"/sim_traffic_statis/top_flow" method:"post" summary:"仪表盘流量top10" tags:"物联网卡管理"`
	Sdate  string `json:"sdate" v:"required#请选择开始时间" dc:"开始时间" `
	Edate  string `json:"edate" v:"required#请选择结束时间" dc:"结束时间"`
	Types  int    `json:"types" v:"required#请填写运营商" dc:"1电信,2联通,3移动"`
}
type TopFlowRes struct {
	Data []TopFlowData `json:"data" dc:"数据"`
}
